package com.shop.front.vo.store;

import com.alibaba.fastjson.annotation.JSONField;
import com.shop.jpa.domain.BaseDomain;
import com.shop.util.IdSignUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>StoreOrderCartInfo 实体类</p>
 * <p>Table: t_store_order_cart_info - 订单购物详情表</p>
 * @author generator
 * @date 2021-02-08 04:15:49
 */
@ApiModel("StoreOrderCartInfo 实体类")
@Data
public class StoreOrderCartInfoVo extends BaseDomain implements Serializable {

    @ApiModelProperty(value = "id", hidden = true)
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
	@JSONField(serialize=false)
    private Long id;

    /**
	 * 订单id
	 */
    @ApiModelProperty("订单id")
	@Column(name = "oid")
    @JSONField(serialize = false)
    private Long oid;

    /**
	 * 购物车id
	 */
    @ApiModelProperty("购物车id")
	@Column(name = "cart_id")
    @JSONField(serialize = false)
    private Long cartId;

    /**
	 * 商品ID
	 */
    @ApiModelProperty("商品ID")
	@Column(name = "product_id")
    @JSONField(serialize = false)
    private Long productId;

    /**
     * 商品规格ID
     */
    @ApiModelProperty("商品规格ID")
    @Column(name = "product_attr_value_id")
    @JSONField(serialize = false)
    private Long productAttrValueId;

    /**
     * 数量
     */
    @ApiModelProperty("数量")
    @Column(name = "cart_num")
    private Integer cartNum;

    /**
     * 单价
     */
    @ApiModelProperty("单价")
    @Column(name = "price")
    private BigDecimal price;

    /**
     * 积分价格
     */
    @ApiModelProperty("需要积分")
    @Column(name = "integral")
    private BigDecimal integral;

    /**
     * 商品总金额
     */
    @ApiModelProperty("商品总金额")
    @Column(name = "total_price")
    private BigDecimal totalPrice;

    /**
     * 图片
     */
    @ApiModelProperty("图片")
    @Column(name = "image")
    private String image;

    /**
     * 商品规格
     */
    @ApiModelProperty("规格")
    @Column(name = "suk")
    private String suk;

    /**
     * 商品名称
     */
    @ApiModelProperty("商品名称")
    @Column(name = "store_name")
    private String storeName;

//    /**
//	 * 购买东西的详细信息
//	 */
//    @ApiModelProperty("购买东西的详细信息")
//	@Column(name = "cart_info")
//    private String cartInfo;

    /**
	 * 创建时间
	 */
    @ApiModelProperty("创建时间")
	@Column(name = "create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 订单id
     */
    @ApiModelProperty("订单id")
    @Transient
    private String oSign;

    /**
     * 购物车id
     */
    @ApiModelProperty("购物车id")
    @Transient
    private String cartSign;

    /**
     * 商品ID
     */
    @ApiModelProperty("商品ID")
    @Transient
    private String productSign;

    public String getProductSign() {
        return IdSignUtil.doSign(this.productId);
    }

    /**
     * 商品规格ID
     */
    @ApiModelProperty("商品规格ID")
    @Transient
    private String productAttrValueSign;

    public String getProductAttrValueSign() {
        return IdSignUtil.doSign(this.productAttrValueId);
    }

}